home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / HippoDraw / HippoDrawSrc1.1 / Hippo.subproj / Rectangle.m < prev    next >
Encoding:
Text File  |  1992-04-25  |  723 b   |  37 lines

  1. #import "Rectangle.h"
  2. #import <dpsclient/wraps.h>
  3.  
  4. @implementation Rectangle : Graphic
  5. /*
  6.  * This is the canonical Graphic.
  7.  * It doesn't get much simpler than this.
  8.  */
  9.  
  10. /* Methods overridden from superclass */
  11.  
  12. - (float)naturalAspectRatio
  13. /*
  14.  * The natural aspect ratio of a rectangle is 1.0 (a square).
  15.  */
  16. {
  17.     return 1.0;
  18. }
  19.  
  20. - draw
  21. {
  22.     if (bounds.size.width < 1.0 || bounds.size.height < 1.0) return self;
  23.  
  24.     if (!NXEqualColor([self fillColor], NX_COLORCLEAR)) {
  25.     [self setFillColor];
  26.     NXRectFill(&bounds);
  27.     }
  28.     if (!NXEqualColor([self lineColor], NX_COLORCLEAR)) {
  29.     [self setLineColor];
  30.     PSrectstroke(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
  31.     }
  32.  
  33.     return self;
  34. }
  35.  
  36. @end
  37.